﻿<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">

  <xsl:output method="xml" indent="yes"/>

  <xsl:template match="/">
    <SalesDocs>
      <xsl:for-each select="DocumentElement/SalesDoc">
        <SalesDoc>
          <DocumentID>
            <xsl:value-of select="SOPNUMBE"/>
          </DocumentID>
          <CustomerID>
            <xsl:value-of select="CUSTNMBR"/>
          </CustomerID>
          <CustomerName>
            <xsl:value-of select="CUSTNAME"/>
          </CustomerName>
          <Type>
            <xsl:if test="SOPTYPE = '1'">Quote</xsl:if>
            <xsl:if test="SOPTYPE = '2'">Order</xsl:if>
            <xsl:if test="SOPTYPE = '3'">Invoice</xsl:if>
            <xsl:if test="SOPTYPE = '4'">Return</xsl:if>
            <xsl:if test="SOPTYPE = '5'">BackOrder</xsl:if>
            <xsl:if test="SOPTYPE = '6'">FulfillmentOrder</xsl:if>
          </Type>
          <Date>
            <xsl:value-of select="DOCDATE"/>
          </Date>
        </SalesDoc>
      </xsl:for-each>
    </SalesDocs>
  </xsl:template>
</xsl:stylesheet>
